<!DOCTYPE html>
<html>
<head>
    <title>Untitled</title>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="assets/pdf/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="assets/pdf/css/bootstrap-responsive.min.css"/>
    <link rel="stylesheet" href="assets/pdf/css/matrix-style.css"/>
    <link href="assets/pdf/font-awesome/css/font-awesome.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/Plus/editor.md/css/editormd.css"/>
    <link rel="stylesheet" href="assets/pdf/kancloud/kancloud.css"/>
    <script src='assets/pdf/js/jquery-1.10.2.min.js'></script>
</head>
<body style="background:#fff;">
<div id="header" style="height: 0;"><h1></h1></div>
<div>
    <div class="widget-box">
        <div class="widget-title"><span class="icon"> <i class="icon-book"></i> </span>
            <h5>文档手册编辑器</h5>
            <div style='line-height:40px;text-align:right;padding-right:20px;' id='addarticle'>
                <input class="btn makepdf" type="button" style="margin-top: -10px;margin-right: -7px; width: 80px;"
                       value="下载PDF"/>
                <input class="btn add_btn" type="button" style="margin-top: -10px;margin-right: -7px; width: 80px;"
                       value="新建文章"/>
                <select id="selectcat">
                    <option value="0">选择文档</option>
                    {{ category }}
                </select>
                <input type="text" name="title" placeholder="请输入文章分类名称" style="width:280px;" class="span7">
                <input type="text" name="author" placeholder="请输入作者" value='mirchen' style="width:140px;" class="span7">
                <input type="text" name="url" placeholder="请输入来源网址" value='' style="width:140px;" class="span7">
                <div class="btn-group"
                     style='height:24px;color:rgb(0,140,186);line-height:24px;margin-left:-6px;margin-top:-15px;'
                     title='保存输入内容'>
                    <button class="btn savebtn">保存</button>
                </div>
            </div>
        </div>
        <div class="widget-content">
            <div id="catelist">
                <div class='cont'>
                    <div class="title" style="border-bottom:1px solid #eee;padding:5px 10px;">
                        <span class="icon-list"></span>
                        文档分类
                        <span style="float:right;" title="添加文档分类">
                            <a href="#addcate" data-toggle="modal" style="color:rgb(0,140,186);">
                                <span class="icon-plus"></span>
                            </a>
                        </span>
                    </div>
                    <div class='category'>
                        <ul style='margin:0;'>
                            {% for cat in catlist %}
                                <li cid="{{ cat['id'] }}" catname='{{ cat['name'] }}'>
                                    {{ cat['level'] }}
                                    <span class='icon-book'></span>
                                    {{ cat['name'] }}
                                    <span class='icon-trash delcat' cid="{{ cat['id'] }}" style="float: right;">&nbsp;</span>
                                    <span class='icon-picture book-titleimg'
                                          id="catid_titleimg_{{ cat['id'] }}"
                                          catid="catid-titleimg-{{ cat['id'] }}"
                                          imgurl="{{ cat['imgurl'] }}" style="float: right;">&nbsp;</span>
                                </li>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
            </div>
            <!--文章列表-->
            <div id="article">
                <div class="title" style="border-bottom:1px solid #eee;padding:5px 10px;">
                    <span class="icon-list"></span>
                    <font class='showcurrcat'>所有分类文章</font>
                </div>
                <div class='category'>
                    <ul style='margin:0;'>
                        {{ list }}
                    </ul>
                </div>
            </div>
            <!--文章列表结束-->
            <div style='width:70%;float:left;'>
                <div id="markdown" style='margin-top:-1px; z-index: 999;'></div>
            </div>
        </div>
    </div>
</div>
<!--点击添加分类的弹出层-->
<div id="addcate" class="modal hide" aria-hidden="true" style="display: none;width:400px;">
    <div class="modal-header" style='padding:0px 10px;'>
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3>添加文档分类</h3>
    </div>
    <div class="modal-body">
        <form class="form-horizontal">
            <div class="control-group">
                <div class="controls" style='margin-left:0px;'>
                    <div class="input-prepend"><span class="add-on">分类名称</span>
                        <input type="text" placeholder="请输入文档分类名称" style="width:280px;" class="span7 addcat-catname">
                    </div>
                </div>

                <div class="controls" style='margin-left:0px;'>
                    <div class="input-prepend"><span class="add-on">上级分类</span>
                        <select name="cat_parentid" style="border-radius: 0;width: 294px;">
                            <option value="0">作为顶级分类</option>
                            {{ category }}
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer" style='padding:4px 10px;border-radius:0px;'>
        <a class="btn btn-success" href="javascript:addcat(this);">确认</a>
        <a data-dismiss="modal" class="btn" href="javascript:;">取消</a>
    </div>
</div>


<div id="show_titleimg" class="modal hide" style="display: none;width:400px;">
    <div class="modal-header" style='padding:0 10px;'>
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3>文档封面</h3>
    </div>
    <div class="modal-body" style="height: auto;">
        <img src="https://box.kancloud.cn/cover_kancloud_web_wangge_design.jpg?imageMogr2/thumbnail/173x231!/interlace/1/quality/100"
             style="width: 380px;"/>
    </div>
    <div class="modal-footer" style='padding:4px 10px;border-radius:0;'>
        <a class="btn btn-success" href="javascript:;">确认</a>
        <a class="btn btn-info" href="javascript:;">更换封面</a>
    </div>
</div>


<div id="upload_imgbox" class="modal hide" style="display:none;width:600px;">
    <div class="modal-header" style='padding:0 10px;'>
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3>上传图片控件</h3>
    </div>
    <div class="modal-body" style="height: 400px;padding: 0;">
        <iframe style="height: 380px;width: 580px;border: none;"></iframe>
    </div>
</div>

<script src="assets/pdf/js/bootstrap.min.js"></script>
<script src="/Plus/layer-v1.9.3/layer/layer.js"></script>
<script src="assets/pdf/js/matrix.js"></script>
<script src="/Plus/editor.md/editormd.min.js"></script>
<script>
    var LIB_PATH = '/Plus/editor.md/lib/';
    var GET_ARTICLE_URL = "{{ url('/api/articles') }}";
    var GET_ARTICLE_INFO_URL = "{{ url('/api/article') }}";
    var DELETE_ARTICLE_URL = "{{ url('/api/delart') }}";
    var ADD_ARTICLE_URL = "{{ url('/api/addart') }}";
    var MAKEPDF_URL = "{{ url('/api/makePdf') }}";
    var UPLOAD_SERVER_URL = "{{ url('/public/upload') }}";
    var ADD_CATEGORY_URL = "{{ url('/api/addcat') }}";
    var DELETE_CATEGORY_URL = "{{ url('/api/delcat') }}";
    var CATEGORY_EDIT_URL = "{{ url('/api/catedit') }}";
</script>
<script type="text/javascript" src="assets/pdf/kancloud/pdfpage.js"></script>
</body>
</html>